package org.example.spring.repository.service;

import org.springframework.transaction.TransactionStatus;

import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;

public interface IDepartmentService {

    default boolean create(String name,boolean hasThrow){return true;};


    void createREQUIRED(String name,boolean hasThrow);



    void createSupports(String name,boolean hasThrow);



    void createMandatory(String name,boolean hasThrow);


    void createRequiredNew(String name,boolean hasThrow);


    void createNever(String name,boolean hasThrow);

    void createNested(String name,boolean hasThrow);


    void asyncCreateRequired(String name,boolean hasThrow);


    /**
     * 手动线程阻塞开启与提交事务
     * @param name
     * @param hasThrow
     */
    default void manualSyncTransactionCreate(String name, boolean hasThrow, CountDownLatch count, AtomicBoolean single) {};


    /**
     * 通过保存事务状态的方式异步创建
     * @param name
     * @param hasThrow
     * @param count
     * @param single
     * @param statusList
     */
    default  void saveStatusAsyncTransactionCreate(String name, boolean hasThrow, CountDownLatch count, AtomicBoolean single, List<TransactionStatus> statusList){};



}
